#ifndef _SOCKET_H_
#define _SOCKET_H_

//clasa utilitara prin care comunica clientul cu serverul
//contine chestii mai lowlevel cum ar fi citire si scriere
//cu streamuri de biti si initializarea conexiunii

class Socket
{
private:
	int _socket;
public:
	int callSocket(char *hostname, unsigned short portnum);
	static int readData(int s, char *buf, int n);
	static int writeData(int s, char *buf, int n);
	static void sendMessage(int socket, int messageType, char *message);
	static void getMessage(int socket, int &type, char *message);
	static void sendMessage(int socket, int messageType, char *message, bool show);
	static void getMessage(int socket, int &type, char *message, bool show);
	int establish(unsigned short portnum);
	int getConnection();
	int getSocket() { return _socket; }
	
	Socket();
	~Socket();
};

#endif
